<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- saved from url=(0059)http://cis-iis2.temple.edu/Spring2012/4344_tuc32262/layout/ -->
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>XML Lab</title>
	<link rel="stylesheet" href="../style4.css" type="text/css">


	</head>


	<body onload="initLibrary()">
		<!--container for content and header areas-->
		<div class="bgWrap">

			<!--BEGIN HEADER/NAV SECTION-------------------------------------------------->
			<div class="headWrap">
				<!--LOGO-->
				<div class="logo">
					<!--thanks to Iconian fonts for the "HTML/CSS" font Bio-disc
									  http://www.iconian.com/ -->
				 	<img class="imgLogo" alt="logo.png" src="../images/logo.png">
				</div>
				<!--END LOGO-->

				<!--BEGIN NAV-->
				<div class="nav">
					<a href="../index.html" class="nav1">&#60;home&#62;</a>
					<a href="../about.html" class="nav1">&#60;about&#62;</a>
					<a href="../download.html" class="nav1">&#60;download&#62;</a>
					<a href="../contact.html" class="nav1">&#60;contact&#62;</a>
                    <div class="dropDownDiv">
                        <span class="menuHead">&#60;labs&#62;</span>
                        <a href="../labs.html">All Labs</a>
                        <a href="../calc.html">Calculator</a>
                        <a href="../slide.html">SlideShow</a>
						<a href="#">Lab 6</a>
						<a href="#">Lab 7</a>
                    </div>
                </div>
				<!--END NAV-------------------------------------------------------------->
			</div>
			<!--END HEADER/NAV SECTION-------------------------------------------------->

			<!-- BEGIN CONTENT SECTON------------------------------------------------------>
			<div class="contentWrap">
				<div class="contentArea">
					<h1 class="home">XML and XSL Lab</h1>
					<div id="xml_out">
					</div>

                </div>
			</div>
			<!--END CONTENT SECTION-------------------------------------->



		</div>
		<!--END bg WRAP SECTION---------------------->

			<div class="footer">
            	<p> Matt Borowiec &nbsp; &nbsp; &nbsp; &nbsp; CIS 4344</p>
			</div>
			<!--BEGIN FOOTER SECTION---------------------------------->

			<script type="text/javascript">
	var xmlDoc;
	    var xmlloaded = false;
	    var xmlOutDiv = document.getElementById("xml_out");


				         function goToURL(URL) {
				            window.location=URL.innerHTML;
				          }

    function initLibrary()
    {
        //importXML("./weather.xml");
       importXML("http://www.weather.gov/xml/current_obs/index.xml");
    }

     function readXML(){
			var xsl = new ActiveXObject("Microsoft.XMLDOM");
			xsl.async = false;
			xsl.load("weather_styles.xsl");
			var trans = xmlDoc.transformNode(xsl);
			//alert(trans.toString());
			xmlOutDiv.innerHTML=trans.toString();
    }

    function importXML(xmlfile)
    {
        try
        {
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open("GET", xmlfile, false);
        }
        catch (Exception)
        {
            var ie = (typeof window.ActiveXObject != 'undefined');

            if (ie)
            {
                xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                xmlDoc.async = false;
                while(xmlDoc.readyState != 4) {};
                xmlDoc.load(xmlfile);
                readXML();
                xmlloaded = true;
            }
            else
            {
                xmlDoc = document.implementation.createDocument("", "", null);
                xmlDoc.onload = readXML;
                xmlDoc.load(xmlfile);
                xmlloaded = true;
            }
        }

        if (!xmlloaded)
        {
            xmlhttp.setRequestHeader('Content-Type', 'text/xml')
            xmlhttp.send("");
            xmlDoc = xmlhttp.responseXML;
            readXML();
            xmlloaded = true;
        }
    }
</script>

</body>
</html>
